package com.henry.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @program: old-service-call
 * @description:
 * @author: Henry.zhang
 * @create: 2022-08-15 11:25
 */
@AllArgsConstructor
@NoArgsConstructor
@Data
public class R<T> {
    /*
    属性列表
    */
    private int code;
    private String msg;
    private T data;


    public  static R ok(Object data){
        R<Object> r = new R<Object>();
        r.setCode(100);
        r.setMsg("okk");
        r.setData(data);
        return r;
    }

    public static R error(){
        R r = new R();
        r.setCode(500);
        r.setMsg("error");
        return r;
    }

    public static R fallback(){
        R r = new R();
        r.setCode(500);
        r.setMsg("fallback method");
        return r;
    }

}
